/**
 * 
 */
package org.vectrics.recruiter.struts.tag.employee;

import org.vectrics.common.html.Cell;
import org.vectrics.common.html.Row;
import org.vectrics.common.html.Table;
import org.vectrics.common.html.TextHelper;
import org.vectrics.common.view.FieldTable;
import org.vectrics.company.CompanyPerson;
import org.vectrics.employee.Employee;
import org.vectrics.recruiter.RecruitServiceLocator;
import org.vectrics.struts.VectricsTagSupport;

/**
 * @author pgoette
 *
 */
public class EmployeeHiringConditionsTag extends VectricsTagSupport {

	 private String personId = null;
	 private String companyId = null;

	/**
	 * @return the personId
	 */
	public String getPersonId() {
		return personId;
	}


	/**
	 * @param personId the personId to set
	 */
	public void setPersonId(String personId) {
		this.personId = personId;
	}


	/**
	 * @return the companyId
	 */
	public String getCompanyId() {
		return companyId;
	}


	/**
	 * @param companyId the companyId to set
	 */
	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}


	@Override
	protected String makeStartTag() {
		// Busco el empleado
		Employee employee =  RecruitServiceLocator.getCompanyService()
		            .findEmployee(new Long(this.getPersonId()), new Long(this.getCompanyId()));
	    String html = "";
	    // Si el empleado es nulo no hago nada
	    if (employee != null) {
	    	// Creo la tabla 
	    	FieldTable mainTable = new FieldTable();
	    	mainTable.setWidth("75%");
	    	// genero la celda con el name 
	    	mainTable.showField(this.getPhrase("prompt.employee.name"), employee.getPerson().getFullName());
	     
	        // genero la celda con el hiring notes
	    	mainTable.showField(this.getPhrase("prompt.employee.hiring.notes"), employee.getHiringNotes());
	        
	        html = mainTable.toString();
	    }
		return html;
	}

	
	
}
